﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QuanLyKhachSanDAO.DTO;
using System.Data;

namespace QuanLyKhachSanDAO.DAO
{
    public class ChiTietPhieuThueDAO
    {
        public static  bool ThemChiTietPhieuThue(ChiTietPhieuThueDTO ctpthue)
        {
            bool kq = false;
            int tt = 0;
            if (ctpthue.TinhTrang == true)
                tt = 1;
            string sql = string.Format("insert into ChiTietPhieuThue(MaPhieuThue,MaKhachHang,TinhTrang) values({0},{1},{2})", ctpthue.MaPhieuThue, ctpthue.MaKhachHang,tt);
            DataProvider ds = new DataProvider();
            kq = ds.ExecuteNonQuery(sql);
            return kq;
        }
        public DataTable DemSoKhachTheoMaPhieuThue(int mapt)
        {
            DataTable tb = new DataTable();
            string sql = string.Format("select count(maphieuthue) from ChiTietPhieuThue where maphieuthue=" + mapt);
            DataProvider ds = new DataProvider();
            tb = ds.ExecuteQuery(sql);
            return tb;
        }
    }
}